using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_HeaderStatementMap : EntityTypeConfiguration<so_HeaderStatement>
    {
        public so_HeaderStatementMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Identity, t.BATCH, t.account__, t.DATE, t.origin });

            // Properties
            this.Property(t => t.Header)
                .HasMaxLength(40);

            this.Property(t => t.Sub_Account)
                .HasMaxLength(35);

            this.Property(t => t.Identity)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.BATCH)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.DESCRIPTION)
                .HasMaxLength(130);

            this.Property(t => t.INVOICE)
                .HasMaxLength(8);

            this.Property(t => t.ID)
                .HasMaxLength(10);

            this.Property(t => t.account__)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.currency)
                .HasMaxLength(3);

            this.Property(t => t.Voucher)
                .HasMaxLength(6);

            this.Property(t => t.CHECK)
                .HasMaxLength(20);

            this.Property(t => t.invoice_reference)
                .HasMaxLength(6);

            this.Property(t => t.Cost_center)
                .HasMaxLength(20);

            this.Property(t => t.origin)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.SumFields)
                .HasMaxLength(100);

            this.Property(t => t.DimFields)
                .HasMaxLength(100);

            this.Property(t => t.HeaderView)
                .HasMaxLength(100);

            this.Property(t => t.FooterView)
                .HasMaxLength(1000);

            // Table & Column Mappings
            this.ToTable("so_HeaderStatement");
            this.Property(t => t.Header).HasColumnName("Header");
            this.Property(t => t.Sub_Account).HasColumnName("Sub_Account");
            this.Property(t => t.Identity).HasColumnName("Identity");
            this.Property(t => t.BATCH).HasColumnName("BATCH");
            this.Property(t => t.DESCRIPTION).HasColumnName("DESCRIPTION");
            this.Property(t => t.INVOICE).HasColumnName("INVOICE");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.account__).HasColumnName("account_#");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.DEBIT).HasColumnName("DEBIT");
            this.Property(t => t.CREDIT).HasColumnName("CREDIT");
            this.Property(t => t.Debit_base_1).HasColumnName("Debit_base_1");
            this.Property(t => t.Credit_base_1).HasColumnName("Credit_base_1");
            this.Property(t => t.Debit_base_2).HasColumnName("Debit_base_2");
            this.Property(t => t.Credit_base_2).HasColumnName("Credit_base_2");
            this.Property(t => t.Voucher).HasColumnName("Voucher");
            this.Property(t => t.CHECK).HasColumnName("CHECK");
            this.Property(t => t.invoice_reference).HasColumnName("invoice_reference");
            this.Property(t => t.Cost_center).HasColumnName("Cost_center");
            this.Property(t => t.REVERSING).HasColumnName("REVERSING");
            this.Property(t => t.CLOSING).HasColumnName("CLOSING");
            this.Property(t => t.JOBID).HasColumnName("JOBID");
            this.Property(t => t.origin).HasColumnName("origin");
            this.Property(t => t.SumFields).HasColumnName("SumFields");
            this.Property(t => t.DimFields).HasColumnName("DimFields");
            this.Property(t => t.HeaderView).HasColumnName("HeaderView");
            this.Property(t => t.FooterView).HasColumnName("FooterView");
        }
    }
}
